import { existsSync, readFileSync, writeFileSync } from "fs";

function fuckType(file: string) {
    if (!existsSync(file)) return;

    let str = readFileSync(file).toString()

    let toStr = "\r\n//@ts-ignore\r\nthrow result.error;";

    if (!str.includes(toStr))
    {
        str = str.replaceAll("throw result.error;", "\r\n//@ts-ignore\r\nthrow result.error;")
        writeFileSync(file, str)
        console.log("成功" + file);
    }
    else
        console.log("已经hack过了");
}

// fuckType("node_modules\\@trpc\\server\\src\\core\\internals\\procedureBuilder.ts")
// fuckType("node_modules\\@trpc\\server\\src\\deprecated\\internals\\procedure.ts")
